package day0608;

import java.util.Arrays;

//复习数组：
public class File9 {
    public static void main(String[] args) {
        //1.创建数组
        String[]  ss={"a" , "米的"  ,"1456"};
        long[]   gs={9L, 5,  6L};//java会自动将5变为5L
        double[]  ds={3.14D,  3.15,  3};//java会自动将3变为3.0

        //2. 存入元素/修改元素： 数组名[序号]=数值
        ss[1]="0";
        gs[1]=0L;
        ds[2]=0.0D;

        //3.获取元素
        System.out.println(ss[2]);
        System.out.println(gs[2]  +" , " + gs[3-1]+" , " + gs[gs.length-1]);

        //4.打印完整的数组
        String gsStr=Arrays.toString(gs);// "9, 0,  6"
        System.out.println(gsStr);

        String ssStr=Arrays.toString(ss);
        System.out.println(ssStr);



        //5.循环操作数组
        double[]  golds={1.0/7, 2.0/7, 4.0/7};
        for(int i=0; i<3 ;i++){
            System.out.println(golds[i]);
        }


    }
}
